<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./haha.js"></script>
  <!-- 一般只用来引入工具文件，不写具体业务 -->
  <script>
    // !!!! 对象（万物皆对象）

    // 选择器


    // 自定义对象
    var xiaoming = {
      name: 'xiaoming',
      sex: 'male',
      eyes: 'big'
    }
    // xiaoming.sex

    // 内置对象
    console.log(xiaoming.sex)


  </script>
</head>

<body>

  <!-- 内联：不主动写，能不用就不用 -->
  <button onclick="alert('haha')">点我1</button>

  <!-- 标签，元素，dom对象 -->
  <button id="b1">点我2</button>



  <script src="./haha.js"></script>
  <script>
    var btn1 = document.getElementById('b1')
    console.log(btn1);
    btn1.onclick = function () {
      alert('hehe')
    }

  </script>
</body>

</html>